package com.smartcommunity.dao.village;

import com.smartcommunity.entity.house.HouseListHouseResp;
import com.smartcommunity.entity.people.RealPeopleHouse;
import com.smartcommunity.entity.people.RealPeopleHouseMove;
import com.smartcommunity.entity.statistic.StatisticByTypeResp;
import com.smartcommunity.entity.village.House;
import com.smartcommunity.entity.village.HouseListReq;
import com.smartcommunity.entity.village.dto.HouseTypeEditBatch;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @version V1.5.0
 * @ClassName: HouseDao
 * @Description: 实有房屋dao
 * @author: minsheng
 * @Date: 2019/1/8 16:34
 * @Company:
 */
@Mapper
public interface HouseDao {

    /**
     * 房屋数据入库
     */
    int insertHouse(List<House> list);

    /**
     * 房屋数据删除
     */
    int deleteHouse(List list);

    /**
     * 房屋数据修改
     */
    int updateHouse(List list);

    /**
     * 人房关系数据入库
     */
    int insertPeopleHouse(List list);

    /**
     * 人房关系数据修改
     */
    int updatePeopleHouse(List list);

    /**
     * 人房关系数据删除
     */
    int deletePeopleHouse(Map map);

    int addHouse(List<House> list);

    List<Map> listPeople(Map map);

    List<Map> getHouse(List list);

    House getHouseById(int id);

    void deletePeopleHouseBatch(List list);

    /**
     * 根据身份证号码，小区号码批量删除人房关系
     *
     * @param list
     */
    void batchDeletePeopleHouse(List list);

    /**
     * @Description: 检测房屋是否存在
     * @param: map
     * @return: House
     * @auther: minsheng
     * @date: 2019/1/24 17:05
     */
    House checkHouse(Map<String, String> map);

    /**
     * 房屋下是否有人口信息
     *
     * @param house
     * @return
     */
    int checkHousePeople(House house);

    House updateCheckHouse(House house);

    /**
     * 查询: 查询指定房屋类型的房屋信息及对应的人员(证件号码)
     *
     * @param param
     * @return
     */
    List<House> queryHouseAndPerson(Map<String, Object> param);

    List<House> queryHouseAndPersonEx(Map<String, Object> param);
    
    List<House> queryHouseAndPersonWithoutMoveout(Map<String, Object> param);

    /**
     * 按类型统计房屋数量
     *
     * @param queryMap
     * @return
     */
    List<Map<String, Object>> countHouseByType(Map<String, Object> queryMap);

    /**
     * 删除人房关系
     *
     * @param credentialNo
     */
    void deleteRelPeopleHouse(String credentialNo);

    /**
     * 获取人房关系
     *
     * @param queryMap
     * @return
     */
    List<RealPeopleHouse> selectRelPeopleHouse(Map<String, Object> queryMap);


    /**
     * 根据小区编号，楼栋编号删除房屋
     */
    void deleteHouseByVillageCode(Map<String, Object> map);

    void deleteNoBuildUnitHouseNo(List list);

    /**
     * 根据小区编号，楼栋编号删除人房关系
     */
    void deleteRelPeopleHouseByVillageCode(Map<String, Object> map);

    /**
     * 修改人房关系迁入迁出数据
     */
    int updatePeopleHouseMoveField(List list);

    int insertPeopleHouseMove(RealPeopleHouseMove realPeopleHouseMove);

    List<RealPeopleHouseMove> selectPeopleHouseMoveList(Map<String, Object> queryMap);

    int getHouseCount();

    List<StatisticByTypeResp> getHouseTypeCount();

    void deleteHouseByBuilding(@Param("villageCode") String villageCode, @Param("buildingNo") String buildingNo);

    List<HouseListHouseResp> list(HouseListReq houseListReq);

    void houseTypeEditBatch(HouseTypeEditBatch houseTypeEditBatch);

    List<House> queryHouseByVillageCode(@Param("villageCode") String villageCode, @Param("buildingNo") String buildingNo,@Param("unitNo") String unitNo );
    
    void updatePeopleBuildingNo(Map<String, Object> map);
}

